#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
#endregion

namespace JigLibX.Utils
{
    public sealed class JiggleUnsafe
    {

        public static float Get(ref Vector3 vec, int index)
        {
            if (index == 0)
                return vec.X;
            if (index == 1)
                return vec.Y;
            return vec.Z;
        }

        public static float Get(Vector3 vec, int index)
        {
            if (index == 0)
                return vec.X;
            if (index == 1)
                return vec.Y;
            return vec.Z;
        }

       /* public static unsafe float Get(ref Vector3 vec, int index)
        {
            fixed (Vector3* adr = &vec)
            {
                return ((float*)adr)[index];
            }
        }

        public static unsafe float Get(Vector3 vec, int index)
        {
            Vector3* adr = &vec;
            return ((float*)adr)[index];
        }

        public static unsafe Vector3 Get(Matrix mat, int index)
        {
            float* adr = &mat.M11;
            adr += index;
            return ((Vector3*)adr)[index];
        }

        public static unsafe Vector3 Get(ref Matrix mat, int index)
        {
            fixed (float* adr = &mat.M11)
            {
                return ((Vector3*)(adr + index))[index];
            }
        }

        public static unsafe void Get(ref Matrix mat, int index, out Vector3 vec)
        {
            fixed (float* adr = &mat.M11)
            {
                vec = ((Vector3*)(adr + index))[index];
            }
        }*/

        public static Vector3 Get(Matrix mat, int index)
        {
            if (index == 0)
                return mat.Backward;
            if (index == 1)
                return mat.Down;
            if (index == 2)
                return mat.Forward;
            if (index == 3)
                return mat.Left;
            if (index == 4)
                return mat.Right;
            return mat.Up;
        }

        public static Vector3 Get(ref Matrix mat, int index)
        {
            if (index == 0)
                return mat.Backward;
            if (index == 1)
                return mat.Down;
            if (index == 2)
                return mat.Forward;
            if (index == 3)
                return mat.Left;
            if (index == 4)
                return mat.Right;
            return mat.Up;

        }

        public static void Get(ref Matrix mat, int index, out Vector3 vec)
        {
            if (index == 0)
                vec = mat.Backward;
            else if (index == 1)
                vec = mat.Down;
            else if (index == 2)
                vec = mat.Forward;
            else if (index == 3)
                vec = mat.Left;
            else if (index == 4)
                vec = mat.Right;
            else
                vec = mat.Up;

        }
    }
}
